package com.example.demo.config;

import com.example.demo.domain.props.MinioProp;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @Author: 聂吉泽
 * @Description:
 * @Date: create in 2021/11/18 10:15
 */
@Configuration
public class CommonConfig {

    @Resource
    private MinioProp minioProp;

    @Bean
    public MinioClient minioClient(){
        return  MinioClient.builder().endpoint(minioProp.getEndPoint())
                .credentials(minioProp.getAccesskey(), minioProp.getSecretKey()).build();
    }
}
